<?php 
//引进配置信息
include 'include/init.php';
include 'include/mysql.config.php';
include 'include/common.fun.php';
include 'data/common_data.php';

if ($_POST) {
	$name=$_POST['username'];
	$password=trim($_POST['password']);
	$sql="SELECT * from wd_user where user_name='$name' ";
	$info=$db->getOne($sql);
	if ($info) {
		if ($info['user_password']==md5($password)) {
			setcookie('user_login',1,time()+3600);
			setcookie('user_id',$info['user_id'],time()+3600);
			alert('登录成功','user_setting.php');
		}else{
			alert('密码错误');
		}
	}else{
		alert('用户名不存在');
	}
}


//加载视图页面
include 'view/user_login.php';


